package com.vincent.dao;

import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Vincent on 2014/12/29.
 */
@Repository("rolePermissionDao")
public class RolePermissionDao {
    @Resource
    private RolePermissionMapper rolePermissionMapper;

    public List<Integer> selectPerIdsByRoleId(int roleId){
        return rolePermissionMapper.selectPerIdByRoleId(roleId);
    }

    public void deleteByPermissionIds(Integer []ids){
        rolePermissionMapper.deleteByPermissionIds(ids);
    }

    public void deleteByRoleIds(Integer []ids){
        rolePermissionMapper.deleteByRoleIds(ids);
    }

    public void grantRolePermissionIds(Integer roleId,Integer []perids){
        rolePermissionMapper.insertRolePerIs(roleId,perids);
    }

}
